<template>
  <view
      class="message"
      :class="{ 'message-user': isUser, 'message-bot': !isUser }"
  >
    <text class="message-content">{{ message.content }}</text>
  </view>
</template>

<script>
export default {
  name: 'ChatMessage',
  props: {
    message: {
      type: Object,
      required: true,
    },
    isUser: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style scoped>
.message {
  display: flex;
  margin: 10px 0;
  max-width: 70%;
}

.message-user {
  align-self: flex-end;
  background-color: #007aff;
  color: white;
  border-radius: 10px 10px 0 10px;
  padding: 10px;
}

.message-bot {
  align-self: flex-start;
  background-color: #f0f0f0;
  color: black;
  border-radius: 10px 10px 10px 0;
  padding: 10px;
}

.message-content {
  font-size: 14px;
}
</style>
